<style>
.item-btn{text-align:center;padding-bottom:15px;position:absolute;right:50px;top:97px;}
</style>
<form class="layui-form layui-font14 layui-jifen" name="" action>
<div class="layui-form-item" style='margin-top:0;'>
<ul class="jifen_top">
<li class='l1'><a href="/jifen/{$data.id}.html" target="_blank" ><img src="{$data.tp}" /></a></li>
<li class='l2'><p class="tit"><a href="/jifen/{$data.id}.html" target="_blank">{$data.tit}</a></p>
	<p>
	库存：不限	</p>


<p>单价：<font color='#e71f19'>{$data.jifen}积分 或 {$data.money}元</font></p></li>
</ul>
</div>
<div class='jifen_cart'>
<div class="layui-form-item">
    <label class="layui-form-label">兑换数量</label>
    <div class="layui-inline">
	<div class="layui-form-mid">
		<div class="j-count-number" style='margin:-3px 0 0 0;'>
			<div class="j-number">
				<input class="j-number-input" value="{$piece}" maxval="-1" name="piece">
				<a class="up"  href="javascript:;">+</a>
				<a class="down" href="javascript:;">-</a>
			</div>
		</div>
	</div>
	</div>
</div>
<div class="layui-form-item" style='padding-bottom:8px;'>
	<label class="layui-form-label">支付方式</label>
	  <div class="layui-inline">
	<div class="layui-input-block">
		<input type="radio" name="paytype" checked value="j" title="积分支付（您的可用积分：<em class='my-jifen'>{$user.jifen}</em> 分）" lay-filter="paytype"/>
	</div>
	<div class="layui-input-block">	<input type="radio" name="paytype" value="m" title="余额支付（您的可用余额：<em class='my-money'>{$user.money}</em> 元）" lay-filter="paytype"/>
	</div>
	</div>
</div>
<div class="layui-form-item" style='padding-bottom:8px;'>
    <label class="layui-form-label">合计</label>
		<div class="layui-input-block">
			<div class="layui-form-mid orange b">
				<b><span class="box-jifen" ><i class="lj-jifen">（{$data.jifen}积分</i></span><span class="box-money" style="display:none;"><i class="lj-money">（余额不足<font color="red">{$data.money}</font>，请先<a style="color:blue;text-decoration:underline" onclick="$('#op').attr('action','/member/onpay/{$data.money}').submit();">充值</a>）</i></span></b>
			</div>
		</div>
</div>
<div class="layui-form-item">
    <label class="layui-form-label">安全码</label>
    <div class="layui-inline">
		<input type="text" name="name" value="m" style="border:0;height:0;width:1px;"/>
<input name="safe" class="layui-input" value="" lay-verify="safe" type="password" placeholder="请输入安全码" style="border:#56aa16 solid 1px;">
</div>
</div>

<div class="item-btn">
    <input type="button" class="layui-btn layui-btn-danger lay-submit" lay-submit="" lay-filter="exchange" value="确认兑换" />
</div>
</div>

<input type="hidden" name="layer" value="1">
<input type="hidden" name="bh" value="{:shop_bh()}">
<input type="hidden" name="j-jifen" value="{$data.jifen}">
<input type="hidden" name="j-money" value="{$data.money}">
<input type="hidden" name="number" value="{$data.bh}">
<input type="hidden" name="action" value="exchange">
<input type="hidden" name="passkey" value="{:passkey()}">
</form>
<form id="op" method="post" action="/member/onpay/" target="_blank" style="display:inline-block"><input type="hidden" value="{:passkey()}" name="passkey" /></form>
<script type="text/javascript">
layer.title('<font  style="font-weight:700;font-size:14px;">积分商城兑换</font>');
layui.use('form', function(){
	var form = layui.form();
	form.on('submit(exchange)', function(data) {
		layer.load();
		dform(data.field,'exchange',function(datas){
			Rs(datas);
		});
		return false;
	});
  	form.on('radio(paytype)', function(data){
		if(data.value=='m'){
			$('.box-money').show()
			$('.box-jifen').hide()
		}else{
			$('.box-money').hide()
			$('.box-jifen').show()
		
		}
		Jtotal();
	}); 
	
	form.render(); //更新全部
Jtotal();
});
</script>
